package com.ndood.app.recon;

import java.text.ParseException;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.ndood.api.base.dao.record_receive.v1.ExtendRecoRecPayDao;
import com.ndood.api.domain.record.receive.v1.service.RecoRecPlatformOfflineOfficialAlif2fService;
import com.ndood.common.base.constaints.CommonConstaints;

@Component
public class ReconTask {

	@Autowired
	private ExtendRecoRecPayDao extendRecoRecPayDao;
	
	@Autowired
	private RecoRecPlatformOfflineOfficialAlif2fService recoRecPlatformOfflineOfficialAlif2fService;

	@Scheduled(cron = "* * * * * ?")
	public void taskRun() throws ParseException {
		// 1 官方支付宝对账
		doWithOfficialAlipayRecociliation();

		// 2 TODO官方微信对账
		// 3 TODO银联对账
	}

	private void doWithOfficialAlipayRecociliation() throws ParseException {
		// Step1: 获取交易流水中的appid集合
		List<Map<String,String>> appList = recoRecPlatformOfflineOfficialAlif2fService.getLastDayRecAppList();
		if(appList.isEmpty()) {
			return;
		}
		
		// Step2: 下载对账单并解析
		
		// Step3: 对账
	}
}
